/*
 * EDAS2 - TetraTech, Inc.
 *
 * Distributable under GPL license.
 * See terms of license at gnu.org.
 */
package com.tetratech.edas2.model;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;

/**
 * State generated by hbm2java
 */
@Entity
@Table(name = "ED_STATE")
public class State extends AttributableUpdateRetireEntity
		implements
			java.io.Serializable {

	private Long uid;
	private Country country;
	private String abbreviation;
	private String name;
	private Short fipsCode;
	private Set<County> counties = new HashSet<County>(0);
	private Set<MonitoringLocation> monitoringLocations = new HashSet<MonitoringLocation>(
			0);

	public State() {
	}

	public State(Long uid, Country country, String abbreviation, String name) {
		this.uid = uid;
		this.country = country;
		this.abbreviation = abbreviation;
		this.name = name;
	}

	@Id
	@Column(name = "ST_UID", unique = true, nullable = false, precision = 6, scale = 0)
	@NotNull
	public Long getUid() {
		return this.uid;
	}

	public void setUid(Long uid) {
		this.uid = uid;
	}
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "CNTRY_UID", nullable = false)
	@NotNull
	public Country getCountry() {
		return this.country;
	}

	public void setCountry(Country country) {
		this.country = country;
	}

	@Column(name = "ST_CD", nullable = false, length = 2)
	@NotNull
	@Length(max = 2)
	public String getAbbreviation() {
		return this.abbreviation;
	}

	public void setAbbreviation(String abbreviation) {
		this.abbreviation = abbreviation;
	}

	@Column(name = "ST_NAME", nullable = false, length = 35)
	@NotNull
	@Length(max = 35)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "ST_FIPS_CD", precision = 4, scale = 0)
	public Short getFipsCode() {
		return this.fipsCode;
	}

	public void setFipsCode(Short fipsCode) {
		this.fipsCode = fipsCode;
	}
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "state")
	public Set<County> getCounties() {
		return this.counties;
	}

	public void setCounties(Set<County> counties) {
		this.counties = counties;
	}
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "state")
	public Set<MonitoringLocation> getMonitoringLocations() {
		return this.monitoringLocations;
	}

	public void setMonitoringLocations(
			Set<MonitoringLocation> monitoringLocations) {
		this.monitoringLocations = monitoringLocations;
	}

}
